﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AgileDashboard.Entities;

namespace PlanningPokerMVC.Models
{

    public class EpicReportRowViewModel
    {

        public string EpicName { get; set; }

        public double ActiveTotal { get; set; }
        public double ResolvedTotal { get; set; }

    }

    public class EpicReportViewModel
    {
        public List<EpicReportRowViewModel> EpicReport { get; set; }


        public EpicReportViewModel()
        {
            EpicReport = new List<EpicReportRowViewModel>();
        }


        public EpicReportViewModel(Dictionary<WorkItem, Dictionary<string, double>> EpicStoryPointSummary)
        {
            EpicReport = new List<EpicReportRowViewModel>();

            foreach (WorkItem key in EpicStoryPointSummary.Keys)
            {
                EpicReportRowViewModel EpicReportRow = new EpicReportRowViewModel();

                EpicReportRow.EpicName = key.Title;

                if (EpicStoryPointSummary[key].ContainsKey("Active"))
                {
                    EpicReportRow.ActiveTotal = EpicStoryPointSummary[key]["Active"];

                }
                if (EpicStoryPointSummary[key].ContainsKey("Resolved"))
                {
                    EpicReportRow.ResolvedTotal = EpicStoryPointSummary[key]["Resolved"];

                }

                EpicReport.Add(EpicReportRow);
            }



            
        }

    }
}